{extend name="common:base"/}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统设置</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{present name="info"}编辑{else /}新增{/present}配置</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content p-xl-important">
                    <form class="form-horizontal" id="signupForm" method="post" action="{:\\think\\Url::build('renew')}" >
                        <div class="form-group ">
                            <label class=" control-label">配置标识<span class="check-tips">(用于Config类函数调用，只能使用英文且不能重复)</span></label>
                            <input id="url" class="form-control input-large" type="text" name="name" value="{$info.name|default=''}">
                        </div>
                        <div class="form-group ">
                            <label class=" control-label">配置标题<span class="check-tips">(用于后台显示的配置标题)</span></label>
                            <input id="title" class="form-control input-large" type="text" name="title" value="{$info.title|default=''}">
                        </div>
                        <div class="form-group ">
                            <label class=" control-label">排序<span class="check-tips">(用于分组显示的顺序)</span></label>
                            <input  class="form-control input-4x" type="text" name="sort" value="{$info.sort|default=0}">
                        </div>
                        <div class="form-group input-large">
                            <label class="control-label">配置类型<span class="check-tips">(系统会根据不同类型解析配置值)</span></label>
                            <select name="type" data-placeholder="顶级菜单" class="chosen-select form-control" tabindex="-1">
                                {notempty name='Think.config.config_type_list'}
                                {volist name="Think.config.config_type_list" id="t"}
                                <option value="{$key}">{$t}</option>
                                {/volist}
                                {/notempty}
                            </select>
                        </div>
                        <div class="form-group input-large">
                            <label class="control-label ">配置分组<span class="check-tips">(配置分组,不分组则不显示在系统设置中)</span></label>
                            <select name="group" data-placeholder="顶级菜单" class="chosen-select form-control" tabindex="-1">
                                <option value="0">不分组</option>
                                {notempty name='Think.config.config_group_list'}
                                {volist name="Think.config.config_group_list" id="g"}
                                <option value="{$key}">{$g}</option>
                                {/volist}
                                {/notempty}
                            </select>
                        </div>
                        <div class="form-group ">
                            <label class="control-label">配置值：<span class="check-tips">(配置值)</span></label>
                            <textarea name="value" class="form-control input-large" rows="4">{$info.value|default=''}</textarea>
                        </div>
                        <div class="form-group ">
                            <label class="control-label">配置项：<span class="check-tips">(如果是枚举型 需要配置该项)</span></label>
                            <textarea name="extra" class="form-control input-large" rows="4">{$info.extra|default=''}</textarea>
                        </div>
                        <div class="form-group ">
                            <label class="control-label">说明：<span class="check-tips">(配置详细说明)</span></label>
                            <textarea name="remark" class="form-control input-large" rows="4">{$info.remark|default=''}</textarea>
                        </div>
                        <div class="form-group">
                            <input type="hidden" name="id" value="{$info.id|default=''}">
                            <button class="btn btn-w-m btn-primary" target-form="form-horizontal" type="submit">提交</button>
                            <button class="btn btn-w-m btn-default retreat">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
{/block}
{block name="css"}
<link href="__CSS__/plugins/chosen/chosen.css" rel="stylesheet">
{/block}
{block name="script"}
<!-- 选择js 加载-->
<script type="text/javascript" src="__JS__/detail.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<!-- Chosen -->
<script src="__JS__/plugins/chosen/chosen.jquery.js"></script>
<script type="text/javascript">
    $(function () {
        highlight_subnav("{:\\think\\Url::build('Deploy/index')}");
        static7.setChoose("type", "{$info.type|default=0}");
        static7.setChoose("group", "{$info.group|default=0}");
        $(".chosen-select").chosen({
            no_results_text: "没有找到",
            allow_single_de: true
        });
        $("#signupForm").validate({
            rules: {
                name: {
                    required: true,
                    minlength: 2
                },
                title: "required"
            },
            messages: {
                name: {
                    required: '配置名称不能为空',
                    minlength: '至少两个字符以上'
                },
                title: {
                    required: "标题不能为空"
                }
            },
            submitHandler: function () {
                validateAjax("#signupForm", "button[type='submit']");
                return false;
            }
        });
    });
</script>
{/block}